﻿using System.Globalization;
using System.Windows.Controls;

namespace NthDownload.Common.Validation.Rules
{
    public class RequiredValidationRule : ValidationRule
    {
        public override ValidationResult Validate(object value, CultureInfo cultureInfo)
        {
            if (value == null)
            {
                return new ValidationResult(false, "Field Required.");
            }

            if (value is string && string.IsNullOrEmpty((string)value))
            {
                return new ValidationResult(false, "Field Required.");
            }

            return new ValidationResult(true, null);
        }
    }
}
